]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
background: Disconnect settings signal handler on destroy
authorAdel Gadllah <adel.gadllah@gmail.com>
Wed, 2 Oct 2013 13:29:30 +0000 (15:29 +0200)
committerAdel Gadllah <adel.gadllah@gmail.com>
Wed, 2 Oct 2013 13:43:30 +0000 (15:43 +0200)
We connect to the changed signal in _init() but never actually disconnect from
it. The callback has a reference to "this" which results into the background
object not getting garbage collected.

Fix that leaks by disconnecting in _destroy()

https://bugzilla.gnome.org/show_bug.cgi?id=709263

js/ui/background.js

index 246060a88e94685119479582df08c6d7235f922b..41e67fe31bae3552b1af3d7a4c92d3e272937ac2 100644 (file)
@@ -319,9 +319,9 @@ const Background = new Lang.Class({
         this._cancellable = new Gio.Cancellable();
         this.isLoaded = false;
 
-        this._settings.connect('changed', Lang.bind(this, function() {
-                                   this.emit('changed');
-                               }));
+        this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() {
+                                            this.emit('changed');
+                                        }));
 
         this._load();
     },
@@ -362,6 +362,10 @@ const Background = new Lang.Class({
 
         this.actor.disconnect(this._destroySignalId);
         this._destroySignalId = 0;
+
+        if (this._settingsChangedSignalId != 0)
+            this._settings.disconnect(this._settingsChangedSignalId);
+        this._settingsChangedSignalId = 0;
     },
 
     _setLoaded: function() {